public class AUTHJNI {

  public static native int GetEnPubKeyFile(String inkeyfile, String outKeyfile);

  public static native int GetDePubKeyFile(String inkeyfile, String outKeyfile);

  public static native String ParseAuthFile(String inkeyfile, String authFile);

  public static native int EncryptAuthFile(String inkeyfile, String authStr, String outfile);

  public static native int CreateEnMachCodeFile(String inkeyfile, String outfile);

  public static native String CreateMachCode();

  public static native String ParseEnMachCodeFile(String inkeyfile, String infile);

  static {
    System.load("/root/jnisoTest/testlib/lib/libauthjni.so");
    System.out.println("loaded /root/jnisoTest/testlib/lib/libauthjni.so");

  }//系统会自己判断后缀。

  public static void main(String[] args) {

    String enKey = "public_en.key";
    String dnKey = "public_dn.key";

    /***
     int ret1 = GetEnPubKeyFile("public.key", enKey);

     System.out.println("ret1 = "+ Integer.toString(ret1));

     int ret2 = GetDePubKeyFile(enKey, dnKey);

     System.out.println("ret2 = "+Integer.toString(ret2));

     int ret3 = EncryptAuthFile("private.key", "hello world", "auth_en.config");

     System.out.println("ret1 = " + Integer.toString( ret3));

     String authinfo = ParseAuthFile(enKey, "auth_en.config");
     System.out.println("authinfo:"+authinfo);

     int ret4 = CreateEnMachCodeFile(enKey, "machCode_en.txt");

     System.out.println("ret4 = " + Integer.toString(ret4));
     ***/
    String machcode2 = CreateMachCode();
    System.out.println("machcode2 = " + machcode2);
    /***
     *
     String machcode = ParseEnMachCodeFile("private.key", "machCode_en.txt");
     System.out.println("machcode:"+machcode);
     ****/

  }
}

